package model.solver;

import java.io.BufferedWriter;
import java.io.IOException;

import model.BasicParameter;
import controller.xml.XMLBaliseFormat;

/**
 * Class that manage the solver parameter.
 * 
 * @author GRONOWSKI Stephane svan001@aol.com
 * 
 *         igsat 2010
 * 
 */
public class SolverParameter extends BasicParameter {

	/**
	 * Create a new solverParameter.
	 */
	public SolverParameter() {
		super();
	}

	/**
	 * Create a new solverParameter.
	 * 
	 * @param basic
	 *            the {@link BasicParameter} of {@link SolverParameter}
	 */
	public SolverParameter(BasicParameter basic) {
		super();
		setTimeOut(basic.getTimeOut());
	}

	@Override
	public boolean basicCheck() {
		if (timeOut != NO_DELAY && timeOut < MIN_DELAY)
			return false;

		return true;
	}

	/**
	 * Export the data in XML
	 * 
	 * @param file
	 *            {@link BufferedWriter} to write
	 * @throws IOException
	 */
	@Override
	public void exportXML(BufferedWriter file) throws IOException {

		// open
		// file.newLine();
		// file.write("<" + XMLBaliseFormat.PARAMETER + ""
		// +XMLBaliseFormat.TYPE_PARAMETER+"="+XMLBaliseFormat.TYPE_PARAMETER_SOLVEUR + " >");
		file.write("<" + XMLBaliseFormat.SOLVER_PARAMETER + ">");

		// basic
		super.exportXML(file);

		// close
		// file.newLine();
		file.write("</" + XMLBaliseFormat.SOLVER_PARAMETER + ">");
	}

}
